﻿using CloudDcPc.Entity;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CloudDcPc.Util
{
    public static class BeanHelper
    {
        public static Order MakeOrder(MySqlDataReader reader)
        {
            Order order = null;
            string vip_num = "", note = "", book_time = "", time = "",together_name="";
            if (!Convert.IsDBNull(reader["vip_num"]))
                vip_num = (string)reader["vip_num"];
            if (!Convert.IsDBNull(reader["note"]))
                note = (string)reader["note"];
            if (!Convert.IsDBNull(reader["time"]))
                time = reader["time"].ToString();
            if (!Convert.IsDBNull(reader["book_time"]))
                book_time = reader["book_time"].ToString();
            if (!Convert.IsDBNull(reader["together_name"]))
                together_name = reader["together_name"].ToString();
            order = new Order((string)reader["tab_name"], (string)reader["uname"], (int)reader["tab_size"], (int)reader["id"], (string)reader["order_num"], (int)reader["tab_num"], vip_num, (int)reader["size"], (int)reader["time_type"], (string)reader["user_num"], time, book_time, (int)reader["type"], note, (int)reader["haschecked"]);
            order.Together_name = together_name;
            return order;
        }
    }
}
